package com.example.lyl.andfixdemo.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

/**
 * Created by dllo on 18/3/10.
 */

public class Utils {
    public static String getVersionName (Context context) {
        String versionName = "1.0,0";
        try {
            PackageManager pm = context.getPackageManager();
            PackageInfo pi = pm.getPackageInfo(context.getPackageName(),0);
            versionName = pi.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return versionName;
    }

    public static void printLog () {
        String error = null;
        Log.d("MainActivity", error);
    }
}
